package com.example.student.util;

import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.example.student.R;


public class ToastUtils {
	static Toast toast;
	public static Dialog mDialog;
	private static View view;
	public static void showLoadingToast(Context context ) {
		if( mDialog != null && mDialog.isShowing()){
			mDialog.dismiss();
		}
		mDialog = new Dialog( context , R.style.Them_dialog);
		LayoutInflater inflater = LayoutInflater.from( context );
		view = inflater.inflate(R.layout.toast_loading,null);
		mDialog.setContentView(view);
		mDialog.setCanceledOnTouchOutside(false);
		mDialog.show();
	}
	public static void showLoadingToast2(Context context ) {
		mDialog = new Dialog( context , R.style.Them_dialog);
		LayoutInflater inflater = LayoutInflater.from( context );
		view = inflater.inflate(R.layout.toast_loading,null);
		mDialog.setContentView(view);
		mDialog.setCanceledOnTouchOutside(false);
		mDialog.show();
	}
	public static void setToastActivity(Context context, String text) {
		Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
	}

	public static void setToastActivity(Context context, String text,int time) {
		Toast.makeText(context, text, Toast.LENGTH_SHORT).show();
	}
	public static void setToastLongActivity(Context context, String text) {
		Toast.makeText(context, text, Toast.LENGTH_LONG).show();
	}


	public static void dismissLoadingToast(){

		if( mDialog != null && mDialog.isShowing()){
			mDialog.dismiss();
		}
	}


}
